import {
    defineStore
} from 'pinia'

export const useUserInfo = defineStore('user', {
    state: () => {
        return {
            name: "",
            avatar: "",
            address: "",
            authorization: "",
            shoppingCart: []
        }
    },
    persist: {
        enabled: true,
        strategies: [{
            storage: localStorage,
            paths: ['name'],
            key: "name"
        }, {
            storage: localStorage,
            paths: ['avatar'],
            key: "avatar"
        }, {
            storage: localStorage,
            paths: ['address'],
            key: "address"
        }, {
            storage: localStorage,
            paths: ['authorization'],
            key: "authorization"
        }],
    },
})